using System;
namespace System.Transactions.Abstractions
{
    public interface ITransaction : IDisposable
    {
        //
        // Summary:
        //     Gets the isolation level of the transaction.
        //
        // Returns:
        //     One of the System.Transactions.IsolationLevel values that indicates the isolation
        //     level of the transaction.
        IsolationLevel IsolationLevel { get; }
     
        //
        // Summary:
        //     Retrieves additional information about a transaction.
        //
        // Returns:
        //     A System.Transactions.TransactionInformation that contains additional information
        //     about the transaction.
        TransactionInformation TransactionInformation { get; }

        // Summary:
        //     Indicates that the transaction is completed.
        //
        // Exceptions:
        //   System.ObjectDisposedException:
        //     An attempt to subscribe this event on a transaction that has been disposed.
        event TransactionInterfaceCompletedEventHandler TransactionCompleted;

        // Summary:
        //     Creates a clone of the transaction.
        //
        // Returns:
        //     A System.Transactions.Transaction that is a copy of the current transaction
        //     object.
        ITransaction Clone();

        //
        // Summary:
        //     Creates a dependent clone of the transaction.
        //
        // Parameters:
        //   cloneOption:
        //     A System.Transactions.DependentCloneOption that controls what kind of dependent
        //     transaction to create.
        //
        // Returns:
        //     A System.Transactions.DependentTransaction that represents the dependent
        //     clone.
        IDependentTransaction DependentClone(DependentCloneOption cloneOption);

        //
        // Summary:
        //     Enlists a durable resource manager that supports two phase commit to participate
        //     in a transaction.
        //
        // Parameters:
        //   resourceManagerIdentifier:
        //     A unique identifier for a resource manager, which should persist across resource
        //     manager failure or reboot.
        //
        //   enlistmentNotification:
        //     An object that implements the System.Transactions.IEnlistmentNotification
        //     interface to receive two phase commit notifications.
        //
        //   enlistmentOptions:
        //     System.Transactions.EnlistmentOptions.EnlistDuringPrepareRequired if the
        //     resource manager wants to perform additional work during the prepare phase.
        //
        // Returns:
        //     An System.Transactions.Enlistment object that describes the enlistment.
        IEnlistment EnlistDurable(Guid resourceManagerIdentifier, ITransactionParticipant enlistmentNotification, EnlistmentOptions enlistmentOptions);
        
        //
        // Summary:
        //     Enlists a durable resource manager that supports single phase commit optimization
        //     to participate in a transaction.
        //
        // Parameters:
        //   resourceManagerIdentifier:
        //     A unique identifier for a resource manager, which should persist across resource
        //     manager failure or reboot.
        //
        //   singlePhaseNotification:
        //     An object that implements the System.Transactions.ISinglePhaseNotification
        //     interface that must be able to receive single phase commit and two phase
        //     commit notifications.
        //
        //   enlistmentOptions:
        //     System.Transactions.EnlistmentOptions.EnlistDuringPrepareRequired if the
        //     resource manager wants to perform additional work during the prepare phase.
        //
        // Returns:
        //     An System.Transactions.Enlistment object that describes the enlistment.
        IEnlistment EnlistDurable(Guid resourceManagerIdentifier, ISinglePhaseTransactionParticipant singlePhaseNotification, EnlistmentOptions enlistmentOptions);

        //
        // Summary:
        //     Enlists a resource manager that has an internal transaction using a promotable
        //     single phase enlistment (PSPE).
        //
        // Parameters:
        //   promotableSinglePhaseNotification:
        //     A System.Transactions.IPromotableSinglePhaseNotification interface implemented
        //     by the participant.
        //
        // Returns:
        //     A System.Transactions.SinglePhaseEnlistment interface implementation that
        //     describes the enlistment.
        bool EnlistPromotableSinglePhase(IPromotableSinglePhaseTransactionParticipant promotableSinglePhaseNotification);
        //
        // Summary:
        //     Enlists a volatile resource manager that supports two phase commit to participate
        //     in a transaction.
        //
        // Parameters:
        //   enlistmentNotification:
        //     An object that implements the System.Transactions.IEnlistmentNotification
        //     interface to receive two phase commit notifications.
        //
        //   enlistmentOptions:
        //     System.Transactions.EnlistmentOptions.EnlistDuringPrepareRequired if the
        //     resource manager wants to perform additional work during the prepare phase.
        //
        // Returns:
        //     An System.Transactions.Enlistment object that describes the enlistment.
        IEnlistment EnlistVolatile(ITransactionParticipant enlistmentNotification, EnlistmentOptions enlistmentOptions);
        //
        // Summary:
        //     Enlists a volatile resource manager that supports single phase commit optimization
        //     to participate in a transaction.
        //
        // Parameters:
        //   singlePhaseNotification:
        //     An object that implements the System.Transactions.ISinglePhaseNotification
        //     interface that must be able to receive single phase commit and two phase
        //     commit notifications.
        //
        //   enlistmentOptions:
        //     System.Transactions.EnlistmentOptions.EnlistDuringPrepareRequired if the
        //     resource manager wants to perform additional work during the prepare phase.
        //
        // Returns:
        //     An System.Transactions.Enlistment object that describes the enlistment.
        IEnlistment EnlistVolatile(ISinglePhaseTransactionParticipant singlePhaseNotification, EnlistmentOptions enlistmentOptions);
        
        //
        // Summary:
        //     Rolls back (aborts) the transaction.
        void Rollback();
        //
        // Summary:
        //     Rolls back (aborts) the transaction.
        //
        // Parameters:
        //   e:
        //     An explanation of why a rollback occurred.
        void Rollback(Exception e);
    }
}